<?php
getHeader();

if (isset($_GET['uid']))
{
	$person = userProf::getUserByUid((int)$_GET['uid']);
	?>
<div id="content">
<div class="tabs headTabs"><span>用户信息</span></div>
<div class="dataList"><span> 用户名: <?php echo $person->name; ?><br />
昵称: <?php echo $person->nickName; ?><br />
性别: <?php echo $person->sex; ?><br />
Email: <?php echo $person->email; ?><br />
院系: <?php echo $person->college; ?><br />
专业: <?php echo $person->pro; ?><br />
年级: <?php echo $person->grade; ?><br />
班级: <?php echo $person->class; ?><br />
自我介绍: <?php echo $person->introduction; ?><br />
参赛经历: <span style="margin-left: 32px;"> <?php
$arr = userTagSeparate($person->competition);
foreach ($arr as $value)
{
	if ($value != '')
	{
		$comp = userCompetitionSeparate($value);
		echo "<br /><a href='?p=search&type=userCompetition&key={$comp[0]}'>{$comp[0]}</a> - {$comp[1]}";
	}
}
?> </span> <br />
个人标签: <?php
$arr = userTagSeparate($person->tag);
foreach ($arr as $value)
{
	echo "<a href='?p=search&type=userTag&key={$value}'>{$value}</a>&nbsp;&nbsp;";
}
?> </span></div>
<div class="tabs headTabs"><span>用户文件</span></div>
<div class="dataList">
<ul>
<?php
$fileList = $person->getUserFile($all = FALSE);
if ($fileList == 'NO')
{
	echo '<span>该用户没有已分享的文件</span>';
}
else
{
	while ($arr = mysql_fetch_array($fileList))
	{
		?>
	<li><span class="fileList"> <?php echo $arr['fileOriname']; ?> </span>
	<span class="fileMeta"> <a
		href='<?php echo UPLOADURL.$arr['fileName']; ?>'>下载</a> </span></li>
		<?php
	}
}
?>
</ul>
</div>
<div class="tabs headTabs"><span>用户相册</span></div>
<div class="dataList"><?php
$result = $person->getUserAlbum();
if ($result == "NO")
{
	echo "<span>该用户还没有创建相册.</span>";
}
else
{
	?>
<ul class="albumList">
<?php
$album = $person->getUserAlbum();
while ($arr = mysql_fetch_array($album))
{
	?>
	<a href='?p=viewAlbum&aid=<?php echo $arr['aid']; ?>'>
	<li><img src="<?php echo getAlbumFirstImageUrl($arr['aid']); ?>"><br />
	<span><?php echo $arr['albumName']; ?></span></li>
	</a>
	<?php
}
?>
	<li style="clear: both; float: none;"></li>
</ul>
<?php
}
?></div>
</div>

<?php
}
else if (isset($_SESSION['uid']))
{
	$person = userProf::getUserByUid((int)$_SESSION['uid']);
	?>
<div id="content">
<div class="tabs headTabs">
<ul>
	<li><a href='?p=editProfile' class="TabLink">修改我的信息</a></li>
</ul>
<span>我的信息</span></div>
<div class="dataList"><span> 用户名: <?php echo $person->name; ?><br />
昵称: <?php echo $person->nickName; ?><br />
性别: <?php echo $person->sex; ?><br />
Email: <?php echo $person->email; ?><br />
院系: <?php echo $person->college; ?><br />
专业: <?php echo $person->pro; ?><br />
年级: <?php echo $person->grade; ?><br />
班级: <?php echo $person->class; ?><br />
自我介绍: <?php echo $person->introduction; ?><br />
参赛经历: <span style="margin-left: 32px;"> <?php
if ($person->competition != '')
{
	$arr = userTagSeparate($person->competition);
	foreach ($arr as $value)
	{
		$comp = userCompetitionSeparate($value);
		echo "<br /><a href='?p=search&type=userCompetition&key={$comp[0]}'>{$comp[0]}</a> - {$comp['1']}";
	}
}
?> </span> <br />
个人标签: <?php
$arr = userTagSeparate($person->tag);
foreach ($arr as $value)
{
	echo "<a href='?p=search&type=userTag&key={$value}'>{$value}</a>&nbsp;&nbsp;";
}
?> </span></div>
<div class="tabs headTabs">
<ul>
	<li><a href='?p=fileUpload' class="TabLink">上传文件</a></li>
</ul>
<span>我的文件</span></div>
<div class="dataList">
<ul>
<?php
$fileList = $person->getUserFile($all = FALSE);
if ($fileList == 'NO')
{
	echo "<span>你还没有<a href='?p=fileUpload'>上传</a>任何文件</span>";
}
else
{
	while ($arr = mysql_fetch_array($fileList))
	{
		?>
	<li><span class="fileList"> <?php echo $arr['fileOriname']; ?> </span>
	<span> &nbsp;-&nbsp;分享状态: <?php if ($arr['fileStatus'] == "Shared") echo "已分享"; else echo "未分享"; ?>
	<span class="fileMeta"> <a
		href='<?php if ($arr['fileStatus'] == "Shared") echo UPLOADURL.$arr['fileName']; else echo UNSHAREDURL.$arr['fileName']; ?>'>下载</a>
	<a href='?p=editFile&action=mod&fid=<?php echo $arr['fid']; ?>'>修改</a>
	<a href='?p=editFile&action=del&fid=<?php echo $arr['fid']; ?>'>删除</a>
	</span></li>
	<?php
	}
}
?>

</ul>
</div>
<div class="tabs headTabs">
<ul>
	<li><a href='?p=uploadImage' class="TabLink">上传相片</a></li>
</ul>
<span>我的相册</span></div>
<div class="dataList"><?php
$result = $person->getUserAlbum();
if ($result == "NO")
{
	echo "<span>你还没有<a href='?p=uploadImage&action=createAlbum'>创建</a>相册.</span>";
}
else
{
	?>
<ul class="albumList">
<?php
while ($arr = mysql_fetch_array($result))
{
	?>
	<a href='?p=viewAlbum&aid=<?php echo $arr['aid']; ?>'>
	<li><img src="<?php echo getAlbumFirstImageUrl($arr['aid']); ?>"><br />
	<span><?php echo $arr['albumName']; ?></span></li>
	</a>
	<?php
}
?>
	<li style="clear: both; float: none;"></li>
</ul>
<?php
}
?></div>
</div>
<?php
}
else
{
	?>
<div id="content">
<div class="tabs headTabs"><span>用户信息</span></div>
<div class="dataList"><span> 你当前为游客, 无法查看本人信息, 请指定一个用户的信息. </span></div>
</div>
	<?php
}
getPanel();
getFooter();
?>
